//
//  EquipmentManagerCell.m
//  PropertyMananger
//
//  Created by bh on 17/2/8.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "EquipmentManagerCell.h"

@implementation EquipmentManagerCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString * equipmentCellID = @"equipmentCellID";
    EquipmentManagerCell * equipmentCell = [tableView dequeueReusableCellWithIdentifier:equipmentCellID];
    if (!equipmentCell) {
        
        equipmentCell = [[EquipmentManagerCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:equipmentCellID];
    }
    equipmentCell.selectionStyle = UITableViewCellSelectionStyleNone;
    equipmentCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return equipmentCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.iconImg = [[UIImageView alloc]init];
        [self.contentView addSubview:self.iconImg];
        
        [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.leading.equalTo(self.contentView).with.offset(15);
            make.centerY.equalTo(self.contentView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
        
        //title
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLabel];
        self.titleLabel.font = BHFont(15);
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        self.titleLabel.textColor = BHColor(51, 51, 51);
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.iconImg.mas_trailing).with.offset(15);
            make.centerY.equalTo(self.contentView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(100, 30));
        }];
    }
    
    return self;
}

@end
